body {
    margin: 0;
    padding: 0;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    display: flex;
    background: #f5f5f5;
    color: #000;
}

body[data-theme="dark"] {
    background-color: #121212;
    color: #fff;
}

.container {
    display: flex;
    width: 100%;
    height: 100vh;
}

.sidebar {
    width: 50px;
    box-shadow: 2px 0 4px rgba(0, 0, 0, 0.1);
}

.sidebar li:hover {
    background: #e0e0e0;
    border-left: solid #1976D2 4px;
}

.sidebar li.active {
    background: #d0d0d0;
    border-left: solid #2196F3 4px;
}

body[data-theme="dark"] .sidebar {
    background: #444;
    box-shadow: 2px 0 4px rgba(0, 0, 0, 0.1);
}

.sidebar ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.sidebar li {
    border-left: solid transparent 4px; /* 添加默认的 border-left */
    padding: 10px;
    cursor: pointer;
    transition: background, border-left-color 0.3s ease-in-out;
}

body[data-theme="dark"] .sidebar li {
    color: #a8a8a8;
}

body[data-theme="dark"] .sidebar li:hover {
    background: #555;
}

body[data-theme="dark"] .sidebar li.active {
    background: #666;
}

.main-content {
    flex: 1;
    padding: 20px 40px;
}

body[data-theme="dark"] .main-content {
}

.search-and-theme-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    position: relative;
}

.search-container {
    flex: 1;
    margin: 0 15px;
    display: flex;
    justify-content: center;
}

#searchInput {
    width: 400px;
    padding: 12px 20px;
    font-size: 16px;
    border: none;
    border-radius: 8px;
    background: white;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    transition: box-shadow 0.3s ease;
}

body[data-theme="dark"] #searchInput {
    background: #333;
    color: #fff;
    box-shadow: 0 2px 4px rgba(255, 255, 255, 0.1);
}

#searchInput:focus {
    outline: none;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

body[data-theme="dark"] #searchInput:focus {
    box-shadow: 0 4px 8px rgba(255, 255, 255, 0.2);
}

.theme-selector {
    position: absolute;
    right: 0
}

#theme {
    margin-left: 10px;
    padding: 8px;
    border: none;
    border-radius: 4px;
    background: white;
    transition: background 0.3s ease;
}

body[data-theme="dark"] #theme {
    background: #444;
    color: #fff;
}

.folder {
    margin-bottom: 30px;
}

.folder-title {
    margin-top: 0;
    font-size: 20px;
    color: #333;
    margin-bottom: 15px;
    padding-bottom: 8px;
    border-bottom: 2px solid #e5e5e5;
}

body[data-theme="dark"] .folder-title {
    color: #fff;
    border-bottom: 2px solid #555;
}

.subfolder-title {
    color: #333;
    margin-bottom: 15px;
    padding-bottom: 8px;
    border-bottom: 2px solid #e5e5e5;
}

body[data-theme="dark"] .subfolder-title {
    color: #fff;
    border-bottom: 1px solid #555;
}

.bookmark-list {
    padding-right: 15px;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 15px;
}

#bookmarkList {
    overflow-y: auto; /* 确保内容超过窗口高度时能够滚动 */
    max-height: calc(100vh - 100px); /* 设置最大高度为视口高度减去100px */
}

body[data-theme="dark"] #bookmarkList {
    /*background: #1c1c1c;*/
}

.bookmark-item {
    background: white;
    padding: 12px;
    border-radius: 6px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    position: relative; /* Add position relative for actions */
}

body[data-theme="dark"] .bookmark-item {
    background: #444;
    box-shadow: 0 2px 4px rgba(255, 255, 255, 0.1);
}

body[data-theme="dark"] .bookmark-item:hover {
    box-shadow: 0 4px 8px rgba(255, 255, 255, 0.2);
}

.bookmark-item.subfolder {
    background: #f9f9f9;
    font-weight: bold;
}

.bookmark-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.bookmark-actions {
    display: flex;
    flex-direction: column;
    opacity: 0;
    visibility: hidden;
    position: absolute;
    top: 0;
    right: 2px;
    box-sizing: border-box;
    transition: opacity 0.3s ease, visibility 0.5s ease; /* 添加过渡效果 */
}

/* 当鼠标悬停.bookmark-item 的元素上时，会应用特定的样式到其内部的 .bookmark-actions 子元素。*/
.bookmark-item:hover .bookmark-actions {
    opacity: 1;
    visibility: visible;
}

.bookmark-actions button {
    box-sizing: border-box;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
}

.bookmark-actions button svg {
    fill: #1976D2; /* 修改编辑按钮颜色为蓝色 */
    height: 18px;
}

.bookmark-actions button:hover svg {
    fill: #2196F3;
}

body[data-theme="dark"] .bookmark-actions button svg {
    fill: #aaa;
}

body[data-theme="dark"] .bookmark-actions button:hover svg {
    fill: #fff;
}

.bookmark-actions .delete-bookmark svg {
    fill: #cc0000;
}

.bookmark-actions .delete-bookmark:hover svg {
    fill: #ff0000; /* 修改删除按钮颜色为红色 */
}

.bookmark-link {
    color: #2196F3;
    text-decoration: none;
    display: flex;
    align-items: center;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

body[data-theme="dark"] .bookmark-link {
    color: #1976D2;
}

body[data-theme="dark"] .bookmark-link:hover {
    color: #0091EA;
}

.bookmark-favicon {
    width: 16px;
    height: 16px;
    margin-right: 8px;
    flex-shrink: 0;
}

body[data-theme="dark"] ::-webkit-scrollbar {
    background: #333; /* 修改滚动条背景色为较暗的颜色 */
}

body[data-theme="dark"] ::-webkit-scrollbar-thumb {
    background: #555; /* 设置滚动条滑块的颜色 */
    border-radius: 4px;
}

body[data-theme="dark"] ::-webkit-scrollbar-thumb:hover {
    background: #777; /* 设置滚动条滑块悬停时的颜色 */
}

body[data-theme="dark"] ::-webkit-scrollbar-button:decrement {
    height: 16px;
    background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" fill="%23fff"><path d="M8 5l3.5 3.5L12 8l-4-4-4 4 1.5 1.5z"/></svg>'); /* 向上的箭头 */
}

body[data-theme="dark"] ::-webkit-scrollbar-button:increment {
    height: 16px;
    background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" fill="%23fff"><path d="M8 11l3.5-3.5L12 10l-4 4-4-4 1.5-1.5z"/></svg>'); /* 向下的箭头 */
}